From 7a439455bd341e342e544fb02b8a4e7ca9ba2741 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Sat, 24 Feb 2007 14:19:05 +0000 Subject: [PATCH] x86 hvm domain builder, restore: set shared_info.arch.max_pfn for dump-core to know the area to dump Signed-off-by: Isaku Yamahata --- tools/libxc/xc_hvm_build.c | 1 + tools/libxc/xc_hvm_restore.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/tools/libxc/xc_hvm_build.c b/tools/libxc/xc_hvm_build.c index 28bc512218..0792c8522f 100644 --- a/tools/libxc/xc_hvm_build.c +++ b/tools/libxc/xc_hvm_build.c @@ -262,6 +262,7 @@ static int setup_guest(int xc_handle, /* NB. evtchn_upcall_mask is unused: leave as zero. */ memset(&shared_info->evtchn_mask[0], 0xff, sizeof(shared_info->evtchn_mask)); + shared_info->arch.max_pfn = page_array[nr_pages - 1]; munmap(shared_info, PAGE_SIZE); if ( v_end > HVM_BELOW_4G_RAM_END ) diff --git a/tools/libxc/xc_hvm_restore.c b/tools/libxc/xc_hvm_restore.c index 3d292d82cc..001fe2a6e4 100644 --- a/tools/libxc/xc_hvm_restore.c +++ b/tools/libxc/xc_hvm_restore.c @@ -86,6 +86,8 @@ int xc_hvm_restore(int xc_handle, int io_fd, uint8_t *hvm_buf = NULL; unsigned long long v_end, memsize; unsigned long shared_page_nr; + shared_info_t *shared_info = NULL; + xen_pfn_t arch_max_pfn; unsigned long pfn; unsigned int prev_pc, this_pc; @@ -141,6 +143,7 @@ int xc_hvm_restore(int xc_handle, int io_fd, pfns[i] = i; for ( i = HVM_BELOW_4G_RAM_END >> PAGE_SHIFT; i < max_pfn; i++ ) pfns[i] += HVM_BELOW_4G_MMIO_LENGTH >> PAGE_SHIFT; + arch_max_pfn = pfns[max_pfn - 1];/* used later */ /* Allocate memory for HVM guest, skipping VGA hole 0xA0000-0xC0000. */ rc = xc_domain_memory_populate_physmap( @@ -350,6 +353,14 @@ int xc_hvm_restore(int xc_handle, int io_fd, ERROR("setting the shared-info pfn failed!\n"); goto out; } + if ( (xc_memory_op(xc_handle, XENMEM_add_to_physmap, &xatp) != 0) || + ((shared_info = xc_map_foreign_range( + xc_handle, dom, PAGE_SIZE, PROT_READ | PROT_WRITE, + shared_info_frame)) == NULL) ) + goto out; + /* shared_info.arch.max_pfn is used by dump-core */ + shared_info->arch.max_pfn = arch_max_pfn; + munmap(shared_info, PAGE_SIZE); rc = 0; goto out; -- 2.30.2